/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author remichaoul
 */


import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;

public class NameServor {

    public static void main(String[] args){
        
            try{
                    InterfaceCatalogue cata = (InterfaceCatalogue) new Catalogue();
                    InterfaceCatalogue catalogueEnvoyer = (InterfaceCatalogue) UnicastRemoteObject.exportObject(cata, 0);

                    //Registry registry = LocateRegistry.createRegistry(Integer.valueOf(args[0]));
                    Registry registry = LocateRegistry.createRegistry(1099);
                    registry.rebind("catalogue", (Remote) catalogueEnvoyer);

                    InterfacePanier panier = (InterfacePanier) new Panier(cata);
                    InterfacePanier panierEnvoyer = (InterfacePanier) UnicastRemoteObject.exportObject(panier, 0);
                    
                    registry.rebind("panier",panierEnvoyer);

                    for (int i = 0; i< registry.list().length; i++)
                        System.out.println(registry.list()[i]);
                    

            }

            catch(Exception e){
                    e.printStackTrace();
            }
    }
}
